<template>
  <div class="layout_one">
    {{ title }}
    <!-- <el-button @click="handleJump">跳转</el-button> -->
    <el-menu
      active-text-color="#ffd04b"
      background-color="#545c64"
      class="el-menu-vertical-demo"
      default-active="2"
      text-color="#fff"
      @open="handleOpen"
      @close="handleClose"
    >
      <el-sub-menu index="1" :show-timeout="50000" :hide-timeout="50000">
        <template #title>
          <el-icon><location /></el-icon>
          <span>Navigator One</span>
        </template>
        <el-menu-item-group title="Group One">
          <el-menu-item index="1-1">item one</el-menu-item>
          <el-menu-item index="1-2">item two</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="Group Two">
          <el-menu-item index="1-3">item three</el-menu-item>
        </el-menu-item-group>
        <el-sub-menu index="1-4">
          <template #title>item four</template>
          <el-menu-item index="1-4-1">item one</el-menu-item>
        </el-sub-menu>
      </el-sub-menu>
      <el-menu-item index="2">
        <el-icon><document /></el-icon>
        <span>Navigator Two</span>
      </el-menu-item>
      <el-menu-item index="3" disabled>
        <el-icon><document /></el-icon>
        <span>Navigator Three</span>
      </el-menu-item>
      <el-menu-item index="4">
        <el-icon><setting /></el-icon>
        <span>Navigator Four</span>
      </el-menu-item>
      <el-sub-menu index="5">
        <template #title>
          <el-icon><location /></el-icon>
          <span>Navigator One</span>
        </template>
        <el-menu-item-group title="Group One">
          <el-menu-item index="5-1">item one</el-menu-item>
          <el-menu-item index="5-2">item two</el-menu-item>
        </el-menu-item-group>
        <el-menu-item-group title="Group Two">
          <el-menu-item index="5-3">item three</el-menu-item>
        </el-menu-item-group>
        <el-sub-menu index="5-4">
          <template #title>item four</template>
          <el-menu-item index="5-4-1">item one</el-menu-item>
        </el-sub-menu>
      </el-sub-menu>
    </el-menu>

    <!-- <el-menu
      :default-active="activeIndex2"
      class="el-menu-demo"
      mode="horizontal"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      @select="handleSelect"
    >
      <el-menu-item index="1">Processing Center</el-menu-item>
      <el-sub-menu index="2" :show-timeout="1000" :hide-timeout="1000">
        <template #title>Workspace</template>
        <el-menu-item index="2-1">item one</el-menu-item>
        <el-menu-item index="2-2">item two</el-menu-item>
        <el-menu-item index="2-3">item three</el-menu-item>
        <el-sub-menu index="2-4">
          <template #title>item four</template>
          <el-menu-item index="2-4-1">item one</el-menu-item>
          <el-menu-item index="2-4-2">item two</el-menu-item>
          <el-menu-item index="2-4-3">item three</el-menu-item>
        </el-sub-menu>
      </el-sub-menu>
      <el-menu-item index="3" disabled>Info</el-menu-item>
      <el-menu-item index="4">Orders</el-menu-item>
    </el-menu> -->
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive } from "@vue/runtime-core";
import { useRouter } from "vue-router";

export default defineComponent({
  name: "Gou",
  setup() {
    const state = reactive({
      title: "这是狗",
    });

    const router = useRouter();

    const handleOpen = (key: string, keyPath: string[]) => {
      console.log("handleOpen");
      console.log("key", key);
      console.log("keyPath", keyPath);
    };

    const handleClose = (key: string, keyPath: string[]) => {
      console.log("handleClose");
      console.log("key", key);
      console.log("keyPath", keyPath);
    };

    const handleSelect = (key: string, keyPath: string[]) => {
      console.log("handleSelect");
      console.log("key", key);
      console.log("keyPath", keyPath);
    };

    // const handleJump = () => {
    //   router.push({ path: "/mao/tu/zhu" });
    // };
    return {
      ...state,
      // handleJump,
      handleOpen,
      handleClose,
      handleSelect,
    };
  },
});
</script>

<style scoped>
.layout_one {
  background: #fff;
  padding: 20px;
  height: calc(100vh - 140px);
  box-shadow: 0 0 3px #e4e7ed;
}
.layout_one:hover {
  box-shadow: 0 0 5px #cdd0d6;
}
</style>